package com.L.yygh.cmn.listener;

import com.L.yygh.cmn.mapper.DictMapper;
import com.L.yygh.model.cmn.Dict;
import com.L.yygh.vo.cmn.DictEeVo;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.springframework.beans.BeanUtils;

public class DictExcellListener extends AnalysisEventListener<DictEeVo> {
    private DictMapper mapper;

    public DictExcellListener(DictMapper mapper) {
        this.mapper = mapper;
    }

    //一行一行读取
    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
        Dict dict = new Dict();
        BeanUtils.copyProperties(dictEeVo,dict);
        mapper.insert(dict);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
